package com.taikang.hmp.hbusiness.doctor.selfhealth.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.taikang.hmp.frame.common.datastructre.Dto;
import com.taikang.hmp.frame.common.datastructre.support.BaseDto;
import com.taikang.hmp.frame.common.service.impl.BaseServiceImpl;
import com.taikang.hmp.hbusiness.doctor.selfhealth.bean.AutognosisQuestion;
import com.taikang.hmp.hbusiness.doctor.selfhealth.bean.Position;
import com.taikang.hmp.hbusiness.doctor.selfhealth.bean.Symptom1;
import com.taikang.hmp.hbusiness.doctor.selfhealth.service.SymptomService;

public class SymptomServiceImpl extends BaseServiceImpl implements SymptomService{

	@Override
	public List<Dto> getSymptomList(Dto dto) {
		List<Dto> results = new ArrayList<Dto>();
		Position po = new Position();
		po.setBodyRegion(dto.getAsString("bodyRegion"));
		po.setSex(dto.getAsString("sex"));
		po.setAround(dto.getAsString("around"));
		
		List<Symptom1> list = super.getNewDao().queryForList("symptom_space.getSymptomList", po);
		if (list != null && !list.isEmpty()) {
			for(Symptom1 sympton : list){
				Dto  result  = new BaseDto();
				result.put("sympton", sympton.getSymptom());
				result.put("symptonid", sympton.getSymptom_id());
				results.add(result);
			}
		}
		return results;
	}

	@Override
	public void addQuestion(AutognosisQuestion qi) {

		super.getNewDao().insert("symptom_space.insertautognosisquestion",qi);
		
	}

}
